﻿<UserControl x:Class="eNursePHR.userInterfaceLayer.TagControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:ui="clr-namespace:eNursePHR.userInterfaceLayer"
          
    >
    <UserControl.Resources>
        
        <DataTemplate x:Key="TagDisplay">


            <!--<Grid>
                     <Grid.ColumnDefinitions>
						<ColumnDefinition Width="*" />
                     </Grid.ColumnDefinitions>-->
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition  />
                    <RowDefinition  />

                </Grid.RowDefinitions>

                <StackPanel Grid.Row="0"  >

                    <StackPanel Orientation="Horizontal">
                        <StackPanel x:Name="spActionTypeModifier" Orientation="Horizontal" Visibility="Collapsed">
                            <TextBlock Text="{Binding Path=ActionT.SingleConcept}" Foreground="{StaticResource InterventionColor}" Margin="0,0,5,0" VerticalAlignment="Center" />
                            <!--<TextBlock x:Name="tbDelimiter" Text=" - " Foreground="Blue"/>-->
                        </StackPanel>
                        <TextBlock  x:Name="tbTagConcept"
												  Text="{Binding Path=Concept}" 
												  ToolTip="{Binding Path=Definition}"
												  FontWeight="UltraBold" 
												  Width="200"
												  TextWrapping="Wrap"
												 />
                    </StackPanel>

                    <StackPanel x:Name="spOutcomeQualifier" Orientation="Horizontal" >
                        <TextBlock Text="will " />
                        <TextBlock x:Name="tbLatestOutcomeModifier" 
									      Text="{Binding Path=LatestOutcomeModifier, Converter={StaticResource RemoveParentesisOutcomeConceptConverter}}" 
									      Foreground="{StaticResource DiagnosisColor}" Margin="0,0,5,0" 
									      />
                        <Image  x:Name="imgLatestOutcome" Height="15" />
                    </StackPanel>

                </StackPanel>

                <TextBox Grid.Row="1" 
					  x:Name="tbTagComment" 
					  Text="{Binding Path=Comment, UpdateSourceTrigger=PropertyChanged}" 
                                  
                                  FontStyle="Italic"
                                  TextWrapping="Wrap" 
                                  HorizontalAlignment="Left"
                                  TextChanged="tbTagComment_TextChanged"
                                  Width="220"
                                    />


            </Grid>
            <!--</Grid>-->


            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=LatestOutcome}" Value="1">
                    <Setter TargetName="imgLatestOutcome" Property="Source" Value="Outcome Types\Improved.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=LatestOutcome}" Value="2">
                    <Setter TargetName="imgLatestOutcome" Property="Source" Value="Outcome Types\Stabilized.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=LatestOutcome}" Value="3">
                    <Setter TargetName="imgLatestOutcome" Property="Source" Value="Outcome Types\Worsened.png" />
                </DataTrigger>

                <DataTrigger Binding="{Binding Path=TaxonomyType}" Value="CCC/NursingDiagnosis">
                    <Setter Property="Foreground" TargetName="tbTagConcept" Value="{StaticResource DiagnosisColor}" />
                </DataTrigger>

                <DataTrigger Binding="{Binding Path=TaxonomyType}" Value="CCC/NursingIntervention">
                    <Setter Property="Foreground" TargetName="tbTagConcept" Value="{StaticResource InterventionColor}" />
                    <Setter Property="Visibility" TargetName="spActionTypeModifier" Value="Visible" />
                </DataTrigger>

                <!--<DataTrigger Binding="{dat:Binding Path=ActionT.SingleConcept}" Value="{x:Null}">
							<Setter Property="Visibility" TargetName="tbDelimiter" Value="Collapsed" />
                       </DataTrigger>-->

                <DataTrigger Binding="{Binding Path=LatestOutcomeModifier}" Value="{x:Null}">
                    <Setter Property="Visibility" TargetName="spOutcomeQualifier" Value="Collapsed" />
                </DataTrigger>

                <DataTrigger Binding="{Binding Path=TaxonomyType}" Value="CCC/CareComponent">
                    <Setter Property="Foreground" TargetName="tbTagConcept" Value="{StaticResource CareComponentColor}" />
                </DataTrigger>
            </DataTemplate.Triggers>

        </DataTemplate>

        

      

    </UserControl.Resources>
        <Expander  x:Name="exTags" IsExpanded="True"
                  Background="{StaticResource BlueTheme}"
                   VerticalAlignment="Top" Padding="5"
                  >
        <Expander.Header>
            <TextBlock Text="Entry tags" FontSize="13" FontWeight="UltraBold" />
        </Expander.Header>


        <ListView x:Name="lbTags"  
               
                AllowDrop="True" 
                Drop="lbTags_Drop"
                Margin="5,0,0,0"
                SelectionMode="Single"
                SelectionChanged="lbTags_SelectionChanged"
                MinHeight="50"
                MaxHeight="600"
                ItemTemplate="{StaticResource TagDisplay}"
                ItemContainerStyle="{StaticResource GreenItemContainer}"
                Background="{StaticResource ItemTagsBackground}"
                ToolTip="Drag tags (diagnoses and interventions) to this area to attach them to the entry"
                
                >
            <ListView.GroupStyle>
                <GroupStyle HeaderTemplate="{StaticResource CareComponentHeader}" />
            </ListView.GroupStyle>





            <ListView.ContextMenu>
                <ContextMenu x:Name="ctxmTags">
                    <MenuItem Header="Delete tag" x:Name="miDeleteTag" Click="miDeleteTag_Click"  />
                    <MenuItem Header="Plan/Evaluate" x:Name="miManageOutcomes" Click="miManageOutcomes_Click" />

                </ContextMenu>
            </ListView.ContextMenu>
            <!-- <ListView.ItemsPanel>
           <ItemsPanelTemplate>
               <WrapPanel MaxWidth="500" />
           </ItemsPanelTemplate>
       </ListView.ItemsPanel> -->

            <!--<ListView.View>
                <GridView x:Name="gvTagView" AllowsColumnReorder="True"   >

                        <GridViewColumn x:Name="gvcLatestOutcome"
                                        Width="10"
                                          >

                            <GridViewColumn.CellTemplate>
                                
                            </GridViewColumn.CellTemplate>

                        </GridViewColumn>
                        
                        <GridViewColumn x:Name="gvcConcept"
                                        Header="Concept" 
                                        Width="150"
                                          >

                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>

                        </GridViewColumn>
                        

                     
                    </GridView>    
               
           </ListView.View>-->
            <ListView.Resources>
                <!-- Based on http://msdn2.microsoft.com/en-us/library/ms752068.aspx, accessed 12 march 2008 -->

                <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBoxBase}">
                    <Setter Property="SnapsToDevicePixels" Value="True"/>
                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                    <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
                    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                    <Setter Property="MinWidth" Value="120"/>
                    <Setter Property="MinHeight" Value="20"/>
                    <Setter Property="AllowDrop" Value="false"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type TextBoxBase}">
                                <!--<Border 
          Name="Border"
          CornerRadius="2" 
          Padding="2"
          Background="{StaticResource WindowBackgroundBrush}"
          BorderBrush="{StaticResource SolidBorderBrush}"
          BorderThickness="1" >-->
                                <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
                                <!--</Border>-->
                                <!--<ControlTemplate.Triggers>
          <Trigger Property="IsEnabled" Value="False">
            <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}"/>
            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBackgroundBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
          </Trigger>
        </ControlTemplate.Triggers>-->
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>



            </ListView.Resources>
        </ListView>

    </Expander>

</UserControl>
